{extend name="$base" /}
{block name="resources"}
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/member_list.css" />
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>

{/block}
{block name="main"}
<div class="set-style">
	<dl>
		<dt><span class="required">*</span>发布者:</dt>
		<dd>
			<input type="number" id="post_uid" value="">
			<p class="error">请填写发布者</p>
			<p class="hint">设置发布者</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>状态:</dt>
		<dd>
			<input type="number" id="trade_type" value="">
			<p class="error">请输入数量</p>
			<p class="hint">设置数量</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>类型:</dt>
		<dd>
			<input type="number" id="trade_status" value="">
			<p class="error">请输入数量</p>
			<p class="hint">设置数量</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>数量:</dt>
		<dd>
			<input type="number" id="coin_count" value="">
			<p class="error">请输入数量</p>
			<p class="hint">设置数量</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>金额:</dt>
		<dd>
			<input type="number" id="coin_price" value="">
			<p class="error">请输入金额</p>
			<p class="hint">设置金额</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>发布日期:</dt>
		<dd>
			<input type="date" id='add_time' placeholder="请选择日期" class="input-medium" />
			<p class="error">请选择日期</p>
			<p class="hint">设置日期</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>交易日期:</dt>
		<dd>
			<input type="date" id='trade_time' placeholder="请选择日期" class="input-medium" />
			<p class="error">请选择日期</p>
			<p class="hint">设置日期</p>
		</dd>
	</dl>
	<dl>
		<dt><span class="required">*</span>完成交易日期:</dt>
		<dd>
			<input type="date" id='finish_time' placeholder="请选择日期" class="input-medium" />
			<p class="error">请选择日期</p>
			<p class="hint">设置日期</p>
		</dd>
	</dl>
	<button class="edit_button" onclick="addGift()">提交</button>
</div>
{/block}

{block name="script"}
<script>
     var flag = false;//防止重复提交
	//保存
	function addGift(){
	    console.log("保存数据");
		var min_level_name = $("#min_level_name").val();
        var startDate = $("#startDate").val();

		if (min_level_name == '') {
			$("#min_level_name").next().show().css("display","inline-block");
			$("#min_level_name").focus();
			return false;
		} else {
			$(".error").hide();
		}


        if (startDate == '') {
            $("#startDate").next().show().css("display","inline-block");
            $("#startDate").focus();
            return false;
        } else {
            $(".error").hide();
        }


		if(flag){
			return false;
		}
		flag = true;
		$.ajax({
			type : "post",
			url : "ADMIN_MAIN/mine/addCoinPrice",
			data : {
				'cur_price' : min_level_name,
				'cur_time' : startDate
			},
			async : true,
			success : function(data) {
				//alert(JSON.stringify(data));
				if (data["code"] > 0) {
					showMessage('success', data["message"]);
					 location.href="ADMIN_MAIN/Mine/CoinPriceList";
				}else{
					showMessage('error', data["message"]);
				}
				flag = false;
			}
		});
	}
</script>
{/block}